#include "tolua++.h"
#include "GameObject.h"

static int tolua_GameObject_create(lua_State* tolua_S)
{
  const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
  {
    GameObject* tolua_ret = GameObject::create(name);
    int nID = (tolua_ret) ? (int)tolua_ret->m_uID : -1;
    int* pLuaID = (tolua_ret) ? &tolua_ret->m_nLuaID : NULL;
    toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"GameObject");
  }
  return 1;
}

static int tolua_GameObject_getCompant(lua_State* tolua_S)
{
  GameObject* self = (GameObject*)  tolua_tousertype(tolua_S,1,0);
  const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
  {
    CCSprite* tolua_ret = self->getCompant(name);  
    int nID = (tolua_ret) ? (int)tolua_ret->m_uID : -1;
    int* pLuaID = (tolua_ret) ? &tolua_ret->m_nLuaID : NULL;
    toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CCSprite");
  }
  return 1;
}


static int tolua_GameObject_addCompant(lua_State* tolua_S)
{
  GameObject* self = (GameObject*)  tolua_tousertype(tolua_S,1,0);
  const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
  const char* plistname = ((const char*)  tolua_tostring(tolua_S,3,0)); 
  float scale = ((float)  tolua_tonumber(tolua_S,4,0));
  {
    self->addCompant(name, plistname, scale);
  }
  return 1;
}

static int tolua_GameObject_addAction(lua_State* tolua_S)
{
  GameObject* self = (GameObject*)  tolua_tousertype(tolua_S,1,0);
  const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
  const char* plistname = ((const char*)  tolua_tostring(tolua_S,3,0));
  
  {
    self->addAction(name, plistname);
  }
  return 1;
}

static int tolua_GameObject_playAction(lua_State* tolua_S)
{
  GameObject* self = (GameObject*)  tolua_tousertype(tolua_S,1,0);
  const char* compantname = ((const char*)  tolua_tostring(tolua_S,2,0));
  const char* actionname = ((const char*)  tolua_tostring(tolua_S,3,0));
  const char* callback = ((const char*)  tolua_tostring(tolua_S,4,0));
  
  {
    self->playAction(compantname, actionname, callback);
  }
  return 1;
}

static int tolua_GameObject_playActionEx(lua_State* tolua_S)
{
  GameObject* self = (GameObject*)  tolua_tousertype(tolua_S,1,0);
  const char* compantname = ((const char*)  tolua_tostring(tolua_S,2,0));
  CCAction* action = ((CCAction*)  tolua_tousertype(tolua_S,3,0));
  const char* callback = ((const char*)  tolua_tostring(tolua_S,4,0));
  {
    self->playActionEx(compantname, action, callback);
  }
  return 1;
}

